define(
	["webgl","assetSyst"],
	function(webgl, assetSyst) {
		return {
			create: function() {
				function createStaticBuf(bufType, dataType, data, itemSize) {
					var gl	= webgl.gl;
					var buf = gl.createBuffer();
					gl.bindBuffer(bufType, buf);
					gl.bufferData(bufType, new dataType(data), gl.STATIC_DRAW);
					buf.itemSize = itemSize;
					buf.numItems = data.length / itemSize;
					return buf;
					
					//TODO: Error handling when creating buffer?
				}
		
				function pointAttrib(shader, attrib, buf) {
					gl.bindBuffer(gl.ARRAY_BUFFER, buf);
					gl.vertexAttribPointer(shader.getAttribute(attrib), buf.itemSize, gl.FLOAT, false, 0, 0);
				}
			
				//Set points
				var gl = webgl.gl;
				var charBuf = createStaticBuf(gl.ARRAY_BUFFER, Float32Array, [0,1,2,3], 1);
				var idxBuf 	= createStaticBuf(gl.ARRAY_BUFFER, Float32Array, [0,1,2,3], 1);
				var shader	= assetSyst.get("vtext|ftext|shader.sp", function(){});
			
				return {
				
					render: function() {
						if(!shader.isLoaded()) {
							return;
						}
						
						gl.useProgram(shader.program);
						pointAttrib(shader, "charCode", charBuf);
						pointAttrib(shader, "idx", idxBuf);
						gl.drawArrays(gl.POINTS, 0, 4);
					}
				
				};
			}
		};
	}
);